<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义属性</title>
    <script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
    <script>
        $(function(){
            $("#a1").click(function(){
               console.log("当前获取到的id为:"+$(this).attr("data-id"));
            });
        });
    </script>
</head>
<body>
<!--
    编码规范:所有的自定义属性一般命名为:data-xxx
-->
<a id="a1" href="javascript:;" data-id="1">删除</a>
</body>
</html>